package com.eh.iteratorAndComposition.modle;

import com.eh.iteratorAndComposition.base.AbstractMenu;
import com.eh.iteratorAndComposition.base.MenuComponent;
import com.google.common.collect.Lists;

import java.util.Iterator;
import java.util.List;

/**
 * Created by David on 2016/5/1.
 */
public class ParentMenu extends AbstractMenu {
    List<MenuComponent> menus;

    public ParentMenu() {
        name = "中华小餐厅";
        description = "物美价廉， 吃的放心";
        menus = Lists.newArrayList();
    }

    @Override
    public void add(MenuComponent menuComponent) {
        menus.add(menuComponent);
    }

    @Override
    public void remove(MenuComponent menuComponent) {
        menus.remove(menuComponent);
    }

    @Override
    public MenuComponent get(int i) {
        return menus.get(i);
    }

    @Override
    public Iterator<MenuComponent> createIterator() {
        return menus.iterator();
    }
}
